/******************************************************
 *  Project：
 *  Function:
 *  Description: ${description}
 *  PROJECT_FILENAME: ${PROJECT_FILENAME}
 *  Author: coder-itl
 ******************************************************
 *  Copyright $NOW_L by coder-itl
 ******************************************************/


#include "stdio.h"
#include "stdlib.h"

#include "Element.h"
#include "SeqStack.h"


ElementType dataElement[] = {
        {1, "C语言"},
        {2, "Java高级"},
        {3, "Python高级"},
        {4, "C++高级"},
        {5, "GOLang高级"}
};

void TestSeqStack();

int main() {
    TestSeqStack();
    return 0;
}


void TestSeqStack() {
    /* 测试实现应该怎么做? */

    /* 1. 开辟空间 */
    SeqStack *stack = (SeqStack *) malloc(sizeof(SeqStack));
    ElementType *element = (ElementType *) malloc(sizeof(ElementType));

    /* 2. 初始化 */
    InitSeqStack(stack);
    /* 3. 入栈操作 */
    for (int i = 0; i < sizeof(dataElement) / sizeof(dataElement[0]); i++) {
        printf("当前入栈: %d\t%s", dataElement[i].id, dataElement[i].name);
        PushSeqStack(stack, dataElement[i]);
        printf("\n");
    }

    /* 4.出栈操作 */
    PopSeqStack(stack, element);
    printf("当前出栈: %d\t%s\n", element->id, element->name);

    for (int i = 0; i < stack->length; i++) {
        printf("当前栈内元素: %d\t%s\n", stack->elem[i].id, stack->elem[i].name);
    }
    free(stack);

}
